<?php
require_once('dao.php');

$lc = DAOFactory::getPA5DAO()->queryBySeg(0);
$sh = DAOFactory::getSubHeadingDAO()->load($lc[0]->sH);
$des = DAOFactory::getDescriptionDAO()->load($lc[0]->dES);
?>
<?php include_once 'include/header.php'; ?>


<div class="main_wrapper">
    <div class="main_container">
        <div class="left_wrapper">
            <h2> <?php echo $sess->TVar($mh2->textEn, $mh2->textSv); ?> </h2>
            <h3> <?php echo $sess->TVar($sh->textEn, $sh->textSv); ?> </h3>
            <p>
                <?php echo c_to_html($sess->TVar($des->textEn, $des->textSv)); ?>
            </p>
        </div>

        <div class="right_wrapper">
            
            <ul class="thumbnails">
                
               <?php 
                $pc = DAOFactory::getPA5DAO()->queryBySeg(1);
                foreach ($pc as $key => $value):
                $img = DAOFactory::getImageDAO()->load($value->iMAGE);
               
               ?>     
                <li>
                    <a class="image_box2" rel="bookmark" href="#<?php echo $img->id ?>">
                         <img src='<?php echo IMAGE_PATH . $img->name; ?>'/>
                    </a>
                </li>
                
               <?php endforeach; ?>
            
            </ul>


            <?php
            $pc = DAOFactory::getPA5DAO()->queryBySeg(1);
            foreach ($pc as $key => $value):
                $sh = DAOFactory::getSubHeadingDAO()->load($value->sH);
                $img = DAOFactory::getImageDAO()->load($value->iMAGE);
                $des = DAOFactory::getDescriptionDAO()->load($value->dES);
                ?>
                <?php if($key===0 || ($key/2)===1): ?>
                     <div class="uppdag" id="<?php echo $img->id; ?>">
                        <?php else: ?>
                     <div class="uppdag design1" id="<?php echo $img->id; ?>">   
                <?php endif; ?>    
                    
                    <h2><?php echo $sess->TVar($sh->textEn, $sh->textSv); ?></h2>
                    <?php
                    if (!empty($img->name)):
                        ?>
                        <img src='<?php echo IMAGE_PATH . $img->name; ?>' width="339" height="368"/>
                        <?php
                    endif;
                    ?>
                    <p>
                        <?php echo c_to_html($sess->TVar($des->textEn, $des->textSv)); ?>

                    </p>
                </div>
                <?php
            endforeach;
            ?>

        </div>
    </div>
    <div id="main_shadow"></div>
</div>

<?php include_once 'include/footer.php'; ?>